<!DOCTYPE html>
<html>
<head>
  <title>麻雀社区</title>
   <#include "../common/link.ftl">
</head>
<body>

<#include "../common/header.ftl">

<#include "../common/column.ftl">

<div class="layui-container">
    <div class="layui-row layui-col-space15">

        <div class="layui-col-md8">

            <div class="fly-panel" style="margin-bottom: 0;">
                <#--状态栏-->
                <#include "../common/filter.ftl">

                <ul class="fly-list">
                   <#if posts??>
                        <#list posts as post>
                          <li>
                              <a href="${ctx.contextPath}/user/uid/${post.uid}" class="fly-avatar">
                                  <img src="${ctx.contextPath}${post.avatar}" alt="${post.username}">
                              </a>
                              <h2>
                                  <#--0提问,99分享,100讨论,101建议,168公告,169动态-->
                                  <#if post.topic == '0'>
                                    <a class="layui-badge">提问</a>
                                  <#elseif post.topic == '99'>
                                    <a class="layui-badge">分享</a>
                                  <#elseif post.topic == '100'>
                                    <a class="layui-badge">讨论</a>
                                  <#elseif post.topic == '101'>
                                    <a class="layui-badge">建议</a>
                                  <#elseif post.topic == '168'>
                                    <a class="layui-badge">公告</a>
                                  <#elseif post.topic == '169'>
                                    <a class="layui-badge">动态</a>
                                  </#if>

                                  <a href="${ctx.contextPath}/post/detail/${post._id}">${post.title}</a>
                              </h2>
                              <div class="fly-list-info">
                                  <a href="${ctx.contextPath}/user/uid/${post.uid}" link>
                                      <cite>${post.username}</cite>
                                  </a>
                                  <span>${post.createTime?string("yyyy-MM-dd HH:mm:ss")}</span>

                                  <span class="fly-list-kiss layui-hide-xs" title="悬赏财富"><i class="layui-icon layui-icon-dollar">&#xe659;</i> ${post.treasure}</span>
                                  <#if post.isEnd == '0'>
                                      <span class="layui-badge fly-badge-accept layui-hide-xs">已结</span>
                                  <#else>
                                      <span class="layui-badge fly-badge-accept layui-hide-xs">未结</span>
                                  </#if>
                                  <span class="fly-list-nums">
                                <i class="iconfont icon-pinglun1" title="回答"></i> ${post.numReply!''}
                            </span>
                              </div>
                              <div class="fly-list-badge">
                                  <#if post.tag?? && post.tag=="精帖">
                                      <span class="layui-badge layui-bg-red">精帖</span>
                                  </#if>

                              </div>
                          </li>
                        </#list>
                   <#else>
                        <div class="fly-none">没有相关数据</div>
                   </#if>
                </ul>
                <div style="text-align: center">
                    <div id="page">
                    </div>
                </div>

            </div>
        </div>

        <div class="layui-col-md4">

            <div class="fly-panel">
                <h3 class="fly-panel-title">温馨通道</h3>
                <ul class="fly-panel-main fly-list-static">
                    <li>
                        <a href="https://gitee.com/linlanghen/mqshequ" target="_blank">麻雀社区 Gitee (码云) 仓库，欢迎Star</a>
                    </li>
                </ul>
            </div>


            <div class="fly-panel fly-signin">
                <div class="fly-panel-title">
                    签到
                    <i class="fly-mid"></i>
                    <a href="javascript:;" class="fly-link" id="LAY_signinHelp">说明</a>
                    <i class="fly-mid"></i>
                    <a href="javascript:;" class="fly-link" id="LAY_signinTop">活跃榜<span class="layui-badge-dot"></span></a>
                    <span class="fly-signin-days">已连续签到<cite>16</cite>天</span>
                </div>
                <div class="fly-panel-main fly-signin-main">
                    <button class="layui-btn layui-btn-danger" id="LAY_signin">今日签到</button>
                    <span>可获得<cite>5</cite>飞吻</span>

                    <!-- 已签到状态 -->
                    <!--
                    <button class="layui-btn layui-btn-disabled">今日已签到</button>
                    <span>获得了<cite>20</cite>飞吻</span>
                    -->
                </div>
            </div>

            <div class="fly-panel fly-rank fly-rank-reply" id="LAY_replyRank">
                <h3 class="fly-panel-title">回贴周榜</h3>
                <dl>
                    <!--<i class="layui-icon fly-loading">&#xe63d;</i>-->
                    <dd>
                        <a href="${ctx.contextPath}/user/uid/22a99b63132840a3b556d32039920811">
                            <img src="${ctx.contextPath}/static/images/avatar/6.jpg"><cite>麻雀</cite><i>666次回答</i>
                        </a>
                    </dd>

                    <dd>
                        <a href="${ctx.contextPath}/user/uid/d007135a1e09425186316eadf91c5ee3">
                            <img src="${ctx.contextPath}/static/images/avatar/12.jpg"><cite>不羁追梦人</cite><i>888次回答</i>
                        </a>
                    </dd>
                </dl>
            </div>

            <dl class="fly-panel fly-list-one">
                <dt class="fly-panel-title">本周热议</dt>
                <#--<dd>
                    <a href="jie/detail.html">基于 layui 的极简社区页面模版</a>
                    <span><i class="iconfont icon-pinglun1"></i> 16</span>
                </dd>-->

                <!-- 无数据时 -->
                <div class="fly-none">没有相关数据</div>

            </dl>

            <div class="fly-panel">
                <div class="fly-panel-title">
                    广告区域
                </div>
                <div class="fly-panel-main">
                    <a href="#" target="_blank" class="fly-zanzhu" time-limit="2017.09.25-2099.01.01" style="background-color: #5FB878;">广告合作区域</a>
                </div>
            </div>

            <div class="fly-panel fly-link">
                <h3 class="fly-panel-title">友情链接</h3>
                <dl class="fly-panel-main">
                    <dd><a href="http://www.layui.com/" target="_blank">layui</a><dd>
                    <dd><a href="http://layim.layui.com/" target="_blank">WebIM</a><dd>
                    <dd><a href="http://layer.layui.com/" target="_blank">layer</a><dd>
                    <dd><a href="http://www.layui.com/laydate/" target="_blank">layDate</a><dd>
                    <dd><a href="mailto:xianxin@layui-inc.com?subject=%E7%94%B3%E8%AF%B7Fly%E7%A4%BE%E5%8C%BA%E5%8F%8B%E9%93%BE" class="fly-link">申请友链</a><dd>
                </dl>
            </div>

        </div>
    </div>
</div>

<#include "../common/footer.ftl">

<script>
layui.cache.page = 'jie';
layui.cache.user = {
  username: '游客'
  ,uid: -1
  ,avatar: '${ctx.contextPath}/static/images/avatar/00.jpg'
  ,experience: 83
  ,sex: '男'
};
layui.config({
  version: "3.0.0"
  ,base: '${ctx.contextPath}/static/mods/'
}).extend({
  fly: 'index'
}).use('fly');

layui.use('laypage', function(){
    var laypage = layui.laypage;

    //执行一个laypage实例
    laypage.render({
        elem: 'page'
        ,count: ${total} //数据总数，从服务端得到
        ,curr: ${curr}
        ,limit:${limit}
        ,jump: function(page, first){
            //obj包含了当前分页的所有参数，比如：
            console.log(page.curr); //得到当前页，以便向服务端请求对应页的数据。
            console.log(page.limit); //得到每页显示的条数

            //首次不执行
            if(!first){
                window.location.href="${ctx.contextPath}/post/page/${column}/${filter}/"+ page.curr;
            }
        }
    });

});

</script>

</body>
</html>